﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;

namespace YouHP.Pages.WeightHistory
{
    public class HistoryDel : PatientBasePage
    {

        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            this.AddLocation("删除体重信息","");
            this.SetTitle("删除体重信息");
            HandleCommon();

        }

        protected new void HandleCommon()
        {
            int id = RequestTools.GetQueryInt("id", 0);
            if (id <= 0)
            {
                this.AddErrLine("无效的体重历史信息");
                return;
            }
            WeightHistoryInfo info = PatientBLL.Instance.GetWeightHistory(PrData.Id, id);
            if (info.Id <= 0)
            {
                this.AddErrLine("无效的体重历史信息");
                return;
            }
            bool succ = true;
            succ = PatientBLL.Instance.DeleteWeightHistory(PrData.Id, id);
            if (succ)
            {
                this.AddMsgLine("删除成功");
            }
            else
            {
                this.AddMsgLine("删除失败");
            }
            this.SetUrl("/WeightHistory/Index.aspx");
            this.SetMetaRefresh();
        }

    }
}